<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// 分配中间件
Route::get('/', function () {
    return view('welcome');
})->middleware('token');

Route::get('hello', function () {
    return 'hello World!';
});
Route::get('users/{id}', function ($id) {
    return $id;
});
// 路由获取参数
// Route::get('users/{id}', function ($id) {
//     return "User:".$id;
// });
// 多个路由参数
// Route::get('posts/{post}/comments/{comment}', function ($postId,$commentId) {
//     return $postId."-".$commentId;
// });
// 可选参数,需要指定参数的默认值
// Route::get('user/{name}', function ($name='Jane') {
//     return $name;
// });

//路由参数where验证
// Route::get('users/{id}', function ($id) {
//     return $id;
// })->where('id',"[0-9]+");
// Route::get('users/{name}', function ($name) {
//     return $name;
// })->where('name',"[a-zA-z]+");

// 命名路由
// Route::get('users/profile', function () {
//     return "url:".route('profile');
// })->name('profile');
// Route::get('users/{id}/profile', function ($id) {
//     $url=route('profile',['id'=>$id]);
//     return $url;
// })->name('profile');

// 路由绑定控制器
// Route::get('member/info','MemberController@info');
// Route::get('member/info',[
//     'uses'=>'MemberController@info',
//     'as'=>'memberinfo'
//     ]);
Route::get('member/{id}','MemberController@info');